<template>
  <div class="content-item" @click="toSearch(contentItem.id)">
    <img class="item-img"
      :src="contentItem.cover_path"
      alt="">
    <div class="item-text">
      <div class="text-title">{{ contentItem.title }}</div>
      <div class="text-info">{{ contentItem.recommend_reason||contentItem.intro }}</div>
      <div class="text-play">
        <div class="play-user">
          <van-icon name="friends-o" />
          <span> {{ contentItem.nickname }}</span>
        </div>
        <div class="play-user">
          <van-icon name="chart-trending-o" />
          <span> {{ contentItem.tracks }}</span>
        </div>
        <div class="play-user">
          <van-icon name="service-o" />
          <span> {{((contentItem.play||contentItem.count_play)/10000)?.toFixed(2)}}万</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { AnyObjType } from '../../../charts/api/chartsApi';
import {useRouter} from 'vue-router'
const router=useRouter();
defineProps<{
  contentItem:AnyObjType
}>();

const toSearch=(id:any)=>{
  router.push({
    name:'detail',
    params:{
      id
    }
  })
}

</script>

<style scoped lang="less">
.content-item {
  padding: 14px 0;
  border-bottom: 1px #999 solid;
  display: flex;

  .item-img {
    width: 75px;
    height: 75px;
    flex-shrink: 0;
    margin-right: 14px;
  }

  .item-text {
    min-height: 75px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    .text-info {
      font-size: 14px;
      color: #999;
      max-width: 276.34px;
      margin: 10px 0;
      overflow: hidden; 
      text-overflow: ellipsis; 
      display: -webkit-box; 
      -webkit-box-orient: vertical; 
      -webkit-line-clamp: 4;
    }

    .text-play {
      display: flex;
      color: #999;
      font-size: 14px;

      .play-user {
        margin-right: 10px;
      }
    }
  }
}</style>